import instance from "@/request/request";

// 获取验证码请求     返回的是 promise对象    ()=>{}
export  const getCode = ()=>  instance.get("/captcha")

// 登录请求   {}
export  const login = (formData)=>instance.post("/user/login",formData)
// 获取用户信息列表的请求
export  const getUserPageApi = (pageData)=>  instance.get("/user/page", {params:pageData})
// 更新用户状态
export  const updateUserStateApi = (stateInfo)=>  instance.put("/user/updateState",stateInfo)
//批量删除用户信息
export  const batchDeleteUserApi = (ids)=>  instance.delete("/user/batchDelete",{data:ids})
// 获取用户个人信息
export  const getPersonalInfoApi = ()=>  instance.get("/user/personalInfo")
//编辑用户个人信息
export  const updatePersonalInfoApi = (personalInfo)=>  instance.put("/user/editPersonalInfo",personalInfo)
// 修改用户密码
export  const editUserPasswordApi = (userPassword)=>  instance.put("/user/editPassword",userPassword)
// 添加用户信息
export  const addOrUpdateUser = (user)=>instance.post("/user/addOrUpdate",user)
// 根据用户id 获取用户信息
export  const getUserInfoByIdApi = (id)=>  instance.get("/user/getById?id="+id)


// 获取角色列表信息
export  const getRoleListApi = ()=>  instance.get("/role/list")
// 获取角色分页信息
export  const getRolePageApi = (rolePageData)=>  instance.get("/role/page",{params:rolePageData})
// 添加角色信息
export  const addOrUpdateRoleApi = (role)=>instance.post("/role/addOrUpdate",role)
// 根据角色id 查询角色信息
export const getRoleByIdApi = (rid)=> instance.get("/role/getById?id="+rid)
// 根据角色id 删除角色信息
export const deleteRoleByIdApi = (rid)=> instance.delete("/role/deleteById?id="+rid)
// 添加角色权限信息
export const addRolePermissionApi = (rolePermission)=> instance.post("/role/addPermission",rolePermission)
// 根据角色id 查询权限信息
export const getRolePermissionByRoleIdApi = (rid)=> instance.get("/role/getRolePermission?id="+rid)


//获取权限列表
export const getAuthTreeApi = ()=> instance.get("/permission/tree")
//添加权限信息
export const addPermissionApi = (authForm)=> instance.post("/permission/add",authForm)
// 根据id查询权限信息  用于数据回显
export const getPermissionByIdApi = (permissionId)=> instance.get("/permission/getById?id="+permissionId)
// 根据权限id  删除权限信息
export const deletePermissionByIdApi = (permissionId)=> instance.delete("/permission/deleteById?id="+permissionId)
// 根据权限名称 查询权限信息
export const getPermissionByNameApi = (name)=> instance.get("/permission/byName?name="+name)
// 根据用户的身份信息 加载菜单
export const getMenuApi = ()=> instance.get("/user/menu")


// 获取部门列表信息
export  const getDeptListApi = ()=>  instance.get("/dept/list")
//部门分页请求
export  const getDeptPageApi = (pageData)=>  instance.get("/dept/page",{params:pageData})
// 添加 修改部门信息
export const saveOrUpdateApi=(dept)=> instance.post("/dept/saveOrUpdate",dept)
// 删除部门信息
export const deleteDeptApi = (id)=> instance.delete("/dept/delete?id="+id)
//根据id 获取部门信息
export const getDeptInfoApi = (id)=> instance.get("/dept/getById?id="+id)


// 获取学生信息列表
export const studentPageApi = (studentPageData)=> instance.get("/student/page",{params:studentPageData})
//导出学生excel表格 exportStudentExcel
export const exportStudentExcelApi = (excelData)=> instance.get("/student/excel",{params:excelData,responseType:"arraybuffer"})
//批量导入学生信息
export const batchStudentApi = (formData)=> instance.post("/student/batchAdd",formData)
// 添加或编辑学生信息
export const addOrUpdateStudentApi = (formData)=> instance.post("/student/addOrUpdate",formData)
// 根据id 获取学生信息
export const getStudentByIdApi = (id)=> instance.get("/student/getById?id="+id)
// 根据id 删除学生信息   deleteStudentById
export const deleteStudentByIdApi = (id)=> instance.delete("/student/delete?id="+id)



//课程下拉选数据获取
export const courseSelectApi = ()=>instance.get("/course/select")
// 课程分页信息
export const coursePageApi = (pageData)=>instance.get("/course/page",{params:pageData})
//添加更新课程信息
export const addOrUpdateCourseApi = (formData)=> instance.post("/course/saveOrUpdate",formData)
// 根据id 获取课程信息
export const getCourseByIdApi = (id)=> instance.get("/course/getById?id="+id)
// 根据id 删除学生信息   deleteStudentById
export const deleteCourseByIdApi = (id)=> instance.delete("/course/delete?id="+id)


//获取成绩大屏展示信息
export const scoreListApi = ()=> instance.get("/score/month")
//获取成绩分页数据
export const scorePageApi = (pageData)=>instance.get("/score/page",{params:pageData})
//添加更新成绩信息
export const addOrUpdateScoreApi = (formData)=> instance.post("/score/saveOrUpdate",formData)
// 根据id 获取成绩信息
export const getScoreByIdApi = (id)=> instance.get("/score/getById?id="+id)
// 根据id 删除成绩信息
export const deleteScoreByIdApi = (id)=> instance.delete("/score/delete?id="+id)
// 批量导入学生成绩
export const batchAddScoreApi = (formData)=> instance.post("/score/batchAdd",formData)
//导出学生成绩
export const exportScoreExcelApi = (excelData)=> instance.get("/score/excel",{params:excelData,responseType:"arraybuffer"})


//开班计划分页数据
export const schedulePageApi = (pageData)=>instance.get("/schedule/page",{params:pageData})
//添加更新开班计划
export const addOrUpdateScheduleApi = (formData)=> instance.post("/schedule/saveOrUpdate",formData)
// 根据id 获取开班计划
export const getScheduleByIdApi = (id)=> instance.get("/schedule/getById?id="+id)
// 根据id 删除开班计划
export const deleteScheduleByIdApi = (id)=> instance.delete("/schedule/delete?id="+id)


//获取资源下载列表
export const sourcePageApi = (pageData)=>instance.get("/source/page",{params:pageData})
// 下载资源
export const downloadSourceApi = (fileName)=> instance.get("/source/download",{params:{fileName:fileName},responseType:"arraybuffer"})
// 删除资源
export const deleteSourceByIdApi = (uuid)=> instance.delete("/source/delete?uuid="+uuid)
// 上传资源
export const uploadSourceApi = (formData)=>instance.post("/source/upload",formData)
// 添加资源信息
export const addSourceInfoApi = (sourceInfo)=>instance.post("/source/add",sourceInfo)

//查询日志分页数据
export const logPageApi = (pageData)=>instance.get("/log/page",{params:pageData})

//批量删除日志信息
export const batchDeleteLogApi = (ids)=>instance.delete("/log/batchDelete",{data:ids})
export const exportLogExcelApi = (excelData)=> instance.get("/log/excel",{params:excelData,responseType:"arraybuffer"})
